<template>
  <div class="calendar-cell">
    <div v-if="prices" class="price-list">
      <p
        v-for="roomPrice in prices.roomPrices"
        :key="roomPrice.roomTypeId"
        class="price"
      >
        <span class="room-type">{{
          roomTypeMap.get(roomPrice.roomTypeId) || `房型${roomPrice.roomTypeId}`
        }}</span>
        <span class="dots" />
        <span class="rmb">¥</span>
        <span class="price-value">{{
          roomPrice.price.toString().padStart(4, " ")
        }}</span>
      </p>
    </div>
  </div>
</template>

<script setup lang="ts">
const props = defineProps({
  date: {
    type: String,
    required: true
  },
  prices: {
    type: Object,
    default: null
  },
  roomTypeMap: {
    type: Map,
    required: true
  }
});
</script>

<style scoped>
.calendar-cell {
  text-align: left;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0px;
  overflow: hidden;
}

.price-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  overflow: hidden;
}

.price {
  margin: 0;
  font-size: 12px;
  color: #409eff;
  font-weight: bold;
  display: flex;
  align-items: center;
  white-space: nowrap;
  overflow: hidden;
  padding: 2px 4px;
}

.room-type {
  font-size: 14px;
  margin-left: 5px;
  flex-shrink: 0;
}

.dots {
  flex-grow: 1;
  color: #909399;
  margin: 0 4px;
  overflow: hidden;
}

.rmb {
  font-size: 18px;
  color: #ff4d00;
  margin-right: 3px;
}

.price-value {
  font-size: 16px;
  color: #ff4d00;
  margin-right: 4px;
  flex-shrink: 0;
}
</style>
